package com.order.controller;

import com.order.domain.Order;
import com.order.service.AccountService;
import com.order.service.OrderService;
import com.order.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Autowired
    private AccountService accountService;

    @Autowired
    private StockService stockService;

    @PostMapping("/createOrder")
    public String createOrder(@RequestBody Order order){

        try {
            orderService.createOrder(order);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }
}
